package com.gujia.util;

/**
 * Created by GuJia on 2017/7/4.
 */
public class RedisKeyUtil {


    private static String SPLIT = ":";
    private static String BIZ_LIKE="LIKE";
    private static String BIZ_DISlIKE="DISLIKE";
    private static String BIZ_EVENTQUEUE="EVENT_QUEUE";
    private static String BIZ_FOLLOWEE = "FOLLOWEE";
    private static String BIZ_FOLLOWER = "FOLLOWER";
    private static String BIZ_TIMELINE = "TIMELINE";

    public static String getLikeKey(String entityType,int entityId){
        return BIZ_LIKE+SPLIT+entityType+SPLIT+String.valueOf(entityId);
    }


    public static String getDisLikeKey(String entityType,int entityId){
        return BIZ_DISlIKE+SPLIT+entityType+SPLIT+String.valueOf(entityId);
    }

    public static String getEventQueueKey(){
        return BIZ_EVENTQUEUE;
    }

    // 某个实体的粉丝key
    public static String getFollowerKey(String entityType, int entityId) {
        return BIZ_FOLLOWER + SPLIT + entityType + SPLIT + String.valueOf(entityId);
    }

    // 每个用户对某类实体的关注key
    public static String getFolloweeKey(int userId, String entityType) {
        return BIZ_FOLLOWEE + SPLIT + String.valueOf(userId) + SPLIT + entityType;
    }

    public static String getTimelineKey(int userId) {
        return BIZ_TIMELINE + SPLIT + String.valueOf(userId);
    }


}
